<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script>
    async function fn22() {


        //await 会等待promise对象 执行的结果
        var a = await fn();
        alert(a)

    }


    function fn() {

        return new Promise(function (resolve, reject) {

            setTimeout(function () {
                resolve('ok');
            }, 3000)

        });
    }

    fn22();


</script>
</body>
</html>